package com.universe.demo.springboot.sqlhelp.controller;

import com.universe.demo.springboot.entity.Person;
import com.universe.demo.springboot.sqlhelp.SqlHelper;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SqlController {

    @Autowired
    private SqlSession sqlSession;

    @RequestMapping("/sql/get")
    public Object getSql(@RequestBody Person p) {
        String sql = SqlHelper.getMapperSql(sqlSession, "com.universe.demo.springboot.mapper.PersonMapper.selectForSqlTest", p);
        return sql;
    }
}
